package com.shopping.mall.core.module.cart.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.shopping.mall.core.module.goods.entity.Goods;
import com.shopping.mall.core.module.goodsSpecification.entity.GoodsSpecification;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;

import javax.validation.constraints.NotNull;
import java.sql.Timestamp;
import java.util.List;

/**
* Cart实体类
*
* @author zzy
* @date 2021-08-15
*/
@Data
@TableName("cart")
public class Cart {

    public interface insert{
    }

    public interface update{
    }

    @ApiModelProperty(value="用户ID")
    private String userId;

    @ApiModelProperty(value="主键")
    @TableId(type = IdType.UUID)
    private String id;

    @NotNull(message = "goodId不能为空",groups = {insert.class})
    @ApiModelProperty(value="商品ID")
    private String goodId;

    @NotNull(message = "specificationId不能为空",groups = {insert.class})
    @ApiModelProperty(value="规格ID")
    private String specificationId;

    @NotNull(message = "number不能为空",groups = {insert.class})
    @ApiModelProperty(value="数量")
    private Integer number;

    @TableField(exist = false)
    @ApiModelProperty(value="价格")
    private Double price;

    @ApiModelProperty(value="创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Timestamp createAt;

    @ApiModelProperty(value="修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Timestamp updateAt;

    @ApiModelProperty(value = "稍后购买")
    private Integer laterBuy;

    @TableField(exist = false)
    private Goods good;

    @TableField(exist = false)
    private GoodsSpecification specification;

    @TableField(exist = false)
    private Integer type;

    @TableField(exist = false)
    private List<String> cartIds;



}
